package ar.com.hc.utils;

import java.io.IOException;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HCConfiguration {

	private static final String PROP_FILES = "configuration.properties";
	private static final Properties prop = new Properties();

	public static final String DB_DRIVER = "DB_DRIVER";
	public static final String DB_URL = "DB_URL";
	public static final Logger LOGGER = LoggerFactory
			.getLogger(HCConfiguration.class);

	static {
		readProperties();
	}

	public static void readProperties() {
		try {
			prop.load(HCResourcesUtils.getStream(PROP_FILES));
		} catch (IOException e) {
			LOGGER.error("Error leyendo la configuración", e);
		}
	}

	public static void setProperty(String key, String value) {
		prop.setProperty(key, value);
	}

	public static Object get(Object key) {
		return prop.get(key);
	}

	public static String getProperty(String key, String defaultValue) {
		return prop.getProperty(key, defaultValue);
	}

	public static String getProperty(String key) {
		return prop.getProperty(key);
	}

}
